import json

import requests

if __name__ == '__main__':
    url = 'http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=keyword'

    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36',
    }
    data = {
        'cname': '',
        'pid': '',
        'keyword': '北京',
        'pageIndex': '1',
        'pageSize': 1,
    }
    response = requests.post(url=url, data=data, headers=headers)
    kfc_obj = response.json()
    print(kfc_obj)

    # fp = open('./kfc.json', 'w', encoding='utf-8')
    # json.dump(kfc_obj, fp=fp)

